cmake_minimum_required(VERSION 3.19)
project(diver-sim LANGUAGES CXX)

find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets Network)

qt_standard_project_setup()

qt_add_executable(diver-sim
    WIN32 MACOSX_BUNDLE
    main.cpp
    mainwindow.cpp
    mainwindow.h
    mainwindow.ui
    diverpospacket.h diverpospacket.cpp
    rovpospacket.h rovpospacket.cpp
    packetbase.h packetbase.cpp
    packetbasetester.h packetbasetester.cpp
    udpclientthread.h udpclientthread.cpp
    udpserverthread.h udpserverthread.cpp
    udpclient.h udpclient.cpp
    udpserver.h udpserver.cpp
)

target_link_libraries(diver-sim
    PRIVATE
        Qt::Core
        Qt::Widgets
        Qt6::Network
)

include(GNUInstallDirs)

install(TARGETS diver-sim
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET diver-sim
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
